#endif
-/* Define to 1 if XInput 2.0 is available */
-#mesondefine XINPUT_2
-
/* Define to 1 if XInput 2.2 is available */
#mesondefine XINPUT_2_2
if (toplevel->has_pointer &&
!x11_screen->wmspec_check_window &&
mode != NotifyGrab &&
-#ifdef XINPUT_2
mode != XINotifyPassiveGrab &&
mode != XINotifyPassiveUngrab &&
-#endif /* XINPUT_2 */
mode != NotifyUngrab)
toplevel->has_pointer_focus = (focus_in) ? FALSE : TRUE;
G_GNUC_FALLTHROUGH;
case NotifyNonlinear:
case NotifyNonlinearVirtual:
if (mode != NotifyGrab &&
-#ifdef XINPUT_2
mode != XINotifyPassiveGrab &&
mode != XINotifyPassiveUngrab &&
-#endif /* XINPUT_2 */
mode != NotifyUngrab)
toplevel->has_focus_window = (focus_in) ? TRUE : FALSE;
/* We pretend that the focus moves to the grab
*/
if (!x11_screen->wmspec_check_window &&
mode != NotifyGrab &&
-#ifdef XINPUT_2
mode != XINotifyPassiveGrab &&
mode != XINotifyPassiveUngrab &&
-#endif /* XINPUT_2 */
mode != NotifyUngrab)
toplevel->has_pointer_focus = (focus_in) ? TRUE : FALSE;
break;
#include "gdkx11devicemanager-core.h"
#include "gdkdevicemanagerprivate-core.h"
-#ifdef XINPUT_2
#include "gdkx11devicemanager-xi2.h"
-#endif
#include "gdkinternals.h"
#include "gdkprivate-x11.h"
#include "gdkdisplay-x11.h"
{
if (!g_getenv ("GDK_CORE_DEVICE_EVENTS"))
{
-#ifdef XINPUT_2
int opcode, firstevent, firsterror;
Display *xdisplay;
return GDK_X11_DEVICE_MANAGER_CORE (device_manager_xi2);
}
}
-#endif /* XINPUT_2 */
}
GDK_DISPLAY_NOTE (display, INPUT, g_message ("Creating core device manager"));
g_return_val_if_fail (GDK_IS_X11_DEVICE_MANAGER_CORE (device_manager), NULL);
-#ifdef XINPUT_2
if (GDK_IS_X11_DEVICE_MANAGER_XI2 (device_manager))
device = _gdk_x11_device_manager_xi2_lookup (GDK_X11_DEVICE_MANAGER_XI2 (device_manager),
device_id);
- else
-#endif /* XINPUT_2 */
- if (GDK_IS_X11_DEVICE_MANAGER_CORE (device_manager))
- {
- /* It is a core/xi1 device manager, we only map
- * IDs 2 and 3, matching XI2's Virtual Core Pointer
- * and Keyboard.
- */
- if (device_id == VIRTUAL_CORE_POINTER_ID)
- device = GDK_X11_DEVICE_MANAGER_CORE (device_manager)->core_pointer;
- else if (device_id == VIRTUAL_CORE_KEYBOARD_ID)
- device = GDK_X11_DEVICE_MANAGER_CORE (device_manager)->core_keyboard;
- }
+ else if (GDK_IS_X11_DEVICE_MANAGER_CORE (device_manager))
+ {
+ /* It is a core/xi1 device manager, we only map
+ * IDs 2 and 3, matching XI2's Virtual Core Pointer
+ * and Keyboard.
+ */
+ if (device_id == VIRTUAL_CORE_POINTER_ID)
+ device = GDK_X11_DEVICE_MANAGER_CORE (device_manager)->core_pointer;
+ else if (device_id == VIRTUAL_CORE_KEYBOARD_ID)
+ device = GDK_X11_DEVICE_MANAGER_CORE (device_manager)->core_keyboard;
+ }
return device;
}
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
-#ifdef XINPUT_2
if (GDK_IS_X11_DEVICE_XI2 (device))
device_id = _gdk_x11_device_xi2_get_id (GDK_X11_DEVICE_XI2 (device));
- else
-#endif /* XINPUT_2 */
- if (GDK_IS_X11_DEVICE_CORE (device))
- {
- if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
- device_id = VIRTUAL_CORE_KEYBOARD_ID;
- else
- device_id = VIRTUAL_CORE_POINTER_ID;
- }
+ else if (GDK_IS_X11_DEVICE_CORE (device))
+ {
+ if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
+ device_id = VIRTUAL_CORE_KEYBOARD_ID;
+ else
+ device_id = VIRTUAL_CORE_POINTER_ID;
+ }
return device_id;
}
root = GDK_DISPLAY_XROOTWIN (display);
seat = gdk_device_get_seat (gdk_drag_get_device (drag));
-#ifdef XINPUT_2
if (GDK_IS_X11_DEVICE_XI2 (device))
capabilities = GDK_SEAT_CAPABILITY_ALL_POINTING;
else
-#endif
capabilities = GDK_SEAT_CAPABILITY_ALL;
cursor = gdk_drag_get_cursor (drag, x11_drag->current_action);
if (keycode == NoSymbol)
continue;
-#ifdef XINPUT_2
if (GDK_IS_X11_DEVICE_XI2 (device))
{
gint deviceid = gdk_x11_device_get_id (gdk_seat_get_keyboard (seat));
&mods);
}
else
-#endif
{
XGrabKey (GDK_DISPLAY_XDISPLAY (display),
keycode, grab_keys[i].modifiers,
if (keycode == NoSymbol)
continue;
-#ifdef XINPUT_2
if (GDK_IS_X11_DEVICE_XI2 (keyboard))
{
XIGrabModifiers mods;
&mods);
}
else
-#endif /* XINPUT_2 */
{
XUngrabKey (GDK_DISPLAY_XDISPLAY (display),
keycode, grab_keys[i].modifiers,
#include <X11/Xlib.h>
#include <X11/Xutil.h>
-#ifdef XINPUT_2
#include <X11/extensions/XInput2.h>
-#endif
#include <cairo-xlib.h>
GdkX11DeviceManagerCore *_gdk_x11_device_manager_new (GdkDisplay *display);
-#ifdef XINPUT_2
guchar * _gdk_x11_device_xi2_translate_event_mask (GdkX11DeviceManagerXI2 *device_manager_xi2,
GdkEventMask event_mask,
gint *len);
void gdk_x11_device_xi2_store_axes (GdkX11DeviceXI2 *device,
gdouble *axes,
gint n_axes);
-#endif
GdkAtom _gdk_x11_display_manager_atom_intern (GdkDisplayManager *manager,
const gchar *atom_name,
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
GdkSurface *surface;
-#if defined (HAVE_XGENERICEVENTS) && defined (XINPUT_2)
XIEvent *xiev = (XIEvent *) xevent->xcookie.data;
XIDeviceEvent *xidev = (XIDeviceEvent *) xiev;
if (xevent->xany.type == GenericEvent)
surface = gdk_x11_surface_lookup_for_display (display, xidev->event);
else
-#endif
surface = gdk_x11_surface_lookup_for_display (display, xevent->xany.window);
if (display_x11->wm_moveresize_button != 0 && surface != NULL)
{
if ((xevent->xany.type == ButtonRelease &&
- xevent->xbutton.button == display_x11->wm_moveresize_button)
-#if defined (HAVE_XGENERICEVENTS) && defined (XINPUT_2)
- ||
+ xevent->xbutton.button == display_x11->wm_moveresize_button) ||
(xevent->xany.type == GenericEvent &&
xiev->evtype == XI_ButtonRelease &&
- xidev->detail == display_x11->wm_moveresize_button)
-#endif
- )
+ xidev->detail == display_x11->wm_moveresize_button))
{
display_x11->wm_moveresize_button = 0;
wmspec_send_message (display, surface, 0, 0, _NET_WM_MOVERESIZE_CANCEL, 0);
}
break;
-#if defined (HAVE_XGENERICEVENTS) && defined (XINPUT_2)
case GenericEvent:
{
/* we just assume this is an XI2 event */
}
}
break;
-#endif
default:
break;
cdata.set('HAVE_XGENERICEVENTS', 1)
endif
- if xi_dep.found() and cc.has_header('X11/extensions/XInput2.h', dependencies: xi_dep)
- cdata.set('XINPUT_2', 1)
- # Note that we also check that the XIScrollClassInfo struct is defined,
- # because at least Ubuntu Oneiric seems to have XIAllowTouchEvents(),
- # but not the XIScrollClassInfo struct
- has_allow_touch_evens = cc.has_function('XIAllowTouchEvents', dependencies: xi_dep)
- has_scroll_class_info = cc.has_member('XIScrollClassInfo', 'number', dependencies: xi_dep,
- prefix: '''#include <X11/Xlib.h>
- #include <X11/extensions/XInput2.h>''')
- if has_allow_touch_evens and has_scroll_class_info
- cdata.set('XINPUT_2_2', 1)
- endif
+ if not xi_dep.found() or not cc.has_header('X11/extensions/XInput2.h', dependencies: xi_dep)
+ error('X11 backend enabled, but XInput2 not found.')
+ endif
+
+ # Note that we also check that the XIScrollClassInfo struct is defined,
+ # because at least Ubuntu Oneiric seems to have XIAllowTouchEvents(),
+ # but not the XIScrollClassInfo struct
+ has_allow_touch_evens = cc.has_function('XIAllowTouchEvents', dependencies: xi_dep)
+ has_scroll_class_info = cc.has_member('XIScrollClassInfo', 'number', dependencies: xi_dep,
+ prefix: '''#include <X11/Xlib.h>
+ #include <X11/extensions/XInput2.h>''')
+ if has_allow_touch_evens and has_scroll_class_info
+ cdata.set('XINPUT_2_2', 1)
endif
enable_xinerama = get_option('xinerama')